package com.blog.Bard.common.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import com.blog.Bard.common.interceptor.MyInterceptor;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Bean
	public MyInterceptor securityInterceptor() {
		return new MyInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
		// 添加拦截器
		registry.addInterceptor(securityInterceptor()).addPathPatterns("/**").excludePathPatterns("/**/*.js").excludePathPatterns("/**/*.*.js")
				.excludePathPatterns("/**/*.html").excludePathPatterns("/**/*.css").excludePathPatterns("/**/*.json")
				.excludePathPatterns("/**/*.png").excludePathPatterns("/**/*.jpg").excludePathPatterns("/**/*.gif").excludePathPatterns("/**/*.ico");
    }

    
}
